﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Exhibition.Common.CacheManager;
using Exhibition.Dao.ViewModel;
using Exhibition.Service;

namespace Exhibition.WebService
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码、svc 和配置文件中的类名“CommService”。
    // 注意: 为了启动 WCF 测试客户端以测试此服务，请在解决方案资源管理器中选择 CommService.svc 或 CommService.svc.cs，然后开始调试。
    public class CommService : ICommService
    {
        public void DoWork()
        {
        }




        #region 颜色方案
        /// <summary>
        /// 添加颜色方案
        /// </summary>
        /// <param name="mdl"></param>
        /// <returns></returns>
       
        public int SaveColorModel(ColorTypeModel mdl)
        {
            return CenterService.colorTypeService.Save(mdl);
        }

        /// <summary>
        /// 获取颜色方案
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
       
        public ColorTypeModel GetColorById(int id)
        {
            return CenterService.colorTypeService.GetOneById(id);
        }
        /// <summary>
        /// 
        /// </summary>
       
        public List<ColorTypeModel> GetColorList()
        {
            return CenterService.colorTypeService.GetColorList();
        }

        /// <summary>
        /// 删除颜色方案
        /// </summary>
        /// <param name="id"></param>
      
        public int DelColorModel(int id)
        {
            return CenterService.colorTypeService.DelById(id);
        }
        #endregion
        #region 楼层

        /// <summary>
        /// 保存楼层信息
        /// </summary>
        /// <param name="flm"></param>
       
        public int SaveFloorModel(FloorModel flm)
        {
            return CenterService.floorService.Save(flm);
        }

        /// <summary>
        /// 获取楼层
        /// </summary>
        /// <param name="id"></param>
       
        public FloorModel GetFloorById(int id)
        {
            return CenterService.floorService.GetOneById(id);
        }

        
        public List<FloorModel> GetFloorByPId(int pid)
        {
            return CenterService.floorService.GetFloorByPId(pid);
        }

        #endregion
        #region 展位
        /// <summary>
        /// 添加更新
        /// </summary>
        /// <param name="stmdl"></param>
       
        public int SaveStand(StandModel stmdl)
        {
            return CenterService.standService.Save(stmdl);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
         
        public List<StandModel> GetStandList(string key)
        {
            return CenterService.standService.SearchStand(key);
        }


         
        public List<StandModel> GetStandListBy(string key)
        {
            return CenterService.standService.SearchStand(key);
        }

        #endregion
        #region 获取展馆列表
        
        public List<PavilionModel> GetPavilionList()
        {
            //var catcheSiteID = CommonCacheManager.GetCacheData<int>("SiteID" + MembershipService.GetUser().Id);

            var std = CenterService.siteService.GetCurrentSite();
            return CenterService.pavilionService.GetPavilionList(std.Id);
        }
        #endregion
        #region 展位分类列表
        
        public List<BoothClassModel> GetBoothClassList()
        {
           // var catcheSiteID = CommonCacheManager.GetCacheData<int>("SiteID" + MembershipService.GetUser().Id);
            var std = CenterService.siteService.GetCurrentSite();
            return CenterService.boothClassService.GetBoothClassList(std.Id);
        }
        #endregion


        public List<UserCompModel> GetCurrentComp(int topnum,int tp)
        {
            var std = CenterService.siteService.GetCurrentSite();
            if (std != null) {
                return CenterService.userCompService.GetUserComp(topnum,tp);
            }
                return null;
        }
    }
}
